Component({
  options: {
    addGlobalClass: true
  },
  properties: {
    tags: {
      type: Array,
      value: []
    },
    current: {
      type: Number,
      value: 0
    }
  },
  data: {
  },
  lifetimes: {
    attached: function () {
    }
  },
  methods: {
    deleteTag(e) {
      if (this.properties.tags.length < 1 || this.properties.current == -1) return;
      this.triggerEvent('delete',{index:this.properties.current});
    },
    selectTag(e) {
      this.setData({ current: e.target.dataset.index });
      this.triggerEvent('select',{index:e.target.dataset.index});
    },
    showTagInput(e) {
      this.triggerEvent('new');
    },
  }
})
